import { defineStore } from 'pinia'

export const useSpotStore = defineStore('useSpotStore', {

    state: () => {
        return {
            title: '添加数据',
            spotListValue: {},
            id: -1
        }
    },
    getters: {
        getTitle(state) {
            return state.title
        },
        getSpotListValue(state) {
            return state.spotListValue
        },
    },
    actions: {
        setTitle(val) {
            this.title = val
        },
        setSpotListValue(val) {
            this.spotListValue = val
        },
        setId(val) {
            this.id = val
        },
        reset() {
            this.title = '添加数据'
            this.spotListValue = {}
            this.id = -1
        }
    },
    persist: {
        enabled: true,
    }
})